<?php

namespace app\mini\validate;


class StoreCartValidate extends BaseValidate
{
    public function __construct()
    {
        $rule = [
            "goods_rule_id" => "require|integer",
            "quantity"      => "require|integer",
            "is_input"      => "require|in:1,2",
        ];

        $message = [
            "goods_rule_id.require" => "商品规格id必须",
            "goods_rule_id.integer" => "商品规格id必须为整数",
            "quantity.require"      => "商品数量必须",
            "quantity.integer"      => "商品数量必须为整数",
            "is_input.require"      => "操作类型缺失",
            "is_input.in"           => "操作类型必须为1或2",
        ];

        $scene = [
            "add" => ["goods_rule_id", "quantity", "is_input"], // 添加商品到购物车
        ];
        parent::__construct($rule, $message, $scene);
    }
}